﻿<%@ Page Title="" Language="C#" MasterPageFile="~/HRSys.Master" AutoEventWireup="true"
    CodeBehind="EditOrgstructure.aspx.cs" Inherits="HRWebSite.Sys.EditOrgstructure" %>

<%@ Register Assembly="Whidsoft.WebControls.OrgChart" Namespace="Whidsoft.WebControls"
    TagPrefix="OC" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<title id="Title1" runat="server">组织结构</title>
    <script type="text/javascript" src="../Scripts/jquery-1.4.2.js"></script>
    <script type="text/javascript" src="../Scripts/jquery.jmpopups-0.5.1.js"></script>    
    <script type="text/javascript">
        function ShowCommand(argum) {
            var target = "";
            if (argum == 'add') {
                target = 'DepartAdd.aspx';
             }
            else if (argum == 'del') target = 'DepartDel.aspx';
            else if (argum == 'edit') target = 'DepartEdit.aspx';
            if (target != "") {
                $.openPopupLayer({
                    name: "myStaticPopup",
                    width: 550,
                    url: target                    
                });
                $('#MenuOrg').css('display', 'none');
            }
        }

        $(document).ready(function () {
            $('#DepartAdd').css('display', 'none');
            $('#DepartDel').css('display', 'none');
            $('#DepartEdit').css('display', 'none');
            $("[href]").click(function (event) {                
                var patrn = /javascript:void\((\d+)\)/;
                var res = patrn.exec($(event.target).attr('href'));
                if (res != null && res[1] > 0) {
                    window.orgChartParentName = $(event.target).text();
                    window.orgChartParentID = res[1];                    
                    $('#MenuOrg').css('top', $(event.target).offset().top + $(event.target).height());
                    $('#MenuOrg').css('left', $(event.target).parent().offset().left);
                    $('#MenuOrg').css('display', '');
                }
                return true;
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div>
        <OC:OrgChart ID="OrgChart1" runat="server" ChartStyle="Horizontal" ImageFolder="img/" />
    </div>
    <div id='MenuOrg' style="position: absolute; width: 150px; display: none; background: #FFF;
        border: 1px solid #333; padding: 1px;">
        <ul>
            <li><a href='javascript:void(0)' onclick="ShowCommand('add');">添加子部门</a> </li>
            <li><a href='javascript:void(0)' onclick="ShowCommand('del');">删除部门</a></li>
            <li><a href='javascript:void(0)' onclick="ShowCommand('edit');">修改部门</a></li>
        </ul>
    </div>
    
   
</asp:Content>
